package back

import (
	"net/http"

	"github.com/gin-gonic/gin"
)

type WelcomeController struct{}

func (con WelcomeController) Welcome(c *gin.Context) {
	// 验证用户是否过期
	_, err := c.Cookie("id")
	if err != nil {
		c.Redirect(http.StatusFound, "/back/login?error=3")
		return
	}
	userName, _ := c.Cookie("name")
	c.HTML(http.StatusOK, "backstage/index.html", gin.H{
		"barKey":   1,
		"userName": userName,
	})
}
